#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void reverse(int* num, int left, int right)
{
    
    while (left < right) {
     int tem = num[left];
        num[left] = num[right];
        num[right] = tem;
        ++left;
        --right;
    }

}

void rotate(int* nums, int numsSize, int k) {
    k = k % numsSize;

    reverse(nums, 0, numsSize - 1 - k);
    reverse(nums, numsSize - k, numsSize - 1);
    reverse(nums, 0, numsSize - 1);
    
}

int main() {
    int arr[7] = { 1,2,3,4,5,6,7};

    rotate(arr, 7, 3);
    for (int i = 0; i < 7; i++) {
        printf("%d\n", arr[i]);

    }
    return 0;
}